package com.example.kingdee.kingdeeBridge;

import com.example.kingdee.exception.ProcedureException;
import com.example.kingdee.kingdeeBridge.kingdeeImpl.BillImpl;
import com.example.kingdee.kingdeeBridge.kingdeeImpl.impl.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class KingdeeImplFactory {

    @Autowired
    private PurOrderImpl purOrderImpl;
    @Autowired
    private ReceiveNoticeImpl receiveNotice;
    @Autowired
    private InspectBillImpl inspectBill;
    @Autowired
    private TransferDirectImpl transferDirect;
    @Autowired
    private PickMtlImpl pickMtl;
    @Autowired
    private ProInStockImpl proInStock;
    @Autowired
    private SalOutStockImpl salOutStock;
    @Autowired
    private FeedMtrlImpl feedMtrl;
    @Autowired
    private ReturnMtrlImpl returnMtrl;
    @Autowired
    private ProMoRptImpl proMoRpt;

    public BillImpl createReport(String billType){
        switch (billType){
            case "采购收料" : {
                return purOrderImpl;
            }
            case "采购入库" : {
                return receiveNotice;
            }
            case "来料检验" : {
                return inspectBill;
            }
            case "生产领料" : {
                return pickMtl;
            }
            case "生产汇报" : {
                return proMoRpt;
            }
            case "生产补料" : {
                return feedMtrl;
            }
            case "生产退料" : {
                return returnMtrl;
            }
            case "生产调拨" : {
                return transferDirect;
            }
            case "汇报入库" :
            case "生产入库" : {
                return proInStock;
            }
            case "销售出库" :
            case "发货出库" : {
                return salOutStock;
            }
            default: throw new ProcedureException("请传入正确的单据类型");
        }
    }
}
